<?php
/**
 * Created by PhpStorm.
 * User: sojo
 * Date: 2017/12/28
 * Time: 14:17
 */

namespace App\Http\Admin\Administration\Models;

use Framework\BaseClass\Http\Admin\Model;

class WorkflowCopy extends Model
{
    public function add($workflowId, array $copyToIds)
    {
        $saveData = [];
        foreach ($copyToIds as $copyToId) {
            $time = time();
            $saveData[] = [
                'oa_workflow_id' => $workflowId,
                'copy_to_id' => $copyToId,
                'created_at' => $time,
                'updated_at' => $time
            ];
        }

        $workflowCopy = new \App\Eloquent\Oa\WorkflowCopy();
        xAssert($workflowCopy->insert($saveData));
    }
}